package dropbox.common;

/**
 * this class represent rename file/dir command
 * means a folder or a file was renamed on server
 * 
 * @author Yoav
 *
 */

public class RenameCommand extends Command{

	//old dir/file path
	private String oldPath;
	//new dir/file path
	private String newPath;

	/**
	 * d.cont
	 */
	public RenameCommand() {
		super();
	}
	
	/**
	 * constructor
	 * @param oldPath file/dir old path
	 * @param newPath file/dir new path
	 */
	public RenameCommand(String oldPath,String newPath) {
		super();
		this.oldPath=oldPath;
		this.newPath=newPath;
	}


	/**
	 * use FileAction interface to delete a folder/file
	 */
	@Override
	public void execute() {
		getAction().rename(oldPath,newPath);
	}
	
	/**
	 * newPath getter
	 * @return new path of file/folder
	 */
	public String getNewPath() {
		return newPath;
	}
	
	/**
	 * olfPath getter
	 * @return old path of file/dir
	 */
	public String getOldPath() {
		return oldPath;
	}
	
	/**
	 * newPath setter
	 * @param newPath new path of file/dir
	 */
	public void setNewPath(String newPath) {
		this.newPath = newPath;
	}
	
	/**
	 * oldPath setter
	 * @param oldPath old path of file/dir
	 */
	public void setOldPath(String oldPath) {
		this.oldPath = oldPath;
	}
}
